import QtQuick 2.0

Rectangle {
    id: button
    radius: 3
    property string normal_image
    property string hover_image
    property string click_image
    property string disable_image

    signal button_clicked()
    signal button_enter()
    signal button_exit()
    signal button_press()
    signal button_releae()

    onNormal_imageChanged: {
        button_image.source = normal_image
    }

    Image {
        id: button_image
        source: normal_image
        anchors.fill: parent
        fillMode: Image.Stretch
    }

    MouseArea {
        id: button_mouse_area
        anchors.fill: button
        onClicked: button_clicked()
        hoverEnabled: true
        onEntered: {
            button_image.source = hover_image
            button_enter()
        }
        onExited: {
            button_image.source = normal_image
            button_exit()
        }
        onPressed: {
            button_image.source = click_image
            button_press()
        }
        onReleased: {
            button_image.source = normal_image
            button_releae()
        }
    }
}
